package com.maverick.guardianangel;

import java.io.File;

//import com.example.Openpdf;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Build.VERSION;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;

public class AboutUs extends Activity implements OnClickListener{
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       /* R.string.about_text = R.string.about_text1 + android.os.Build.VERSION.RELEASE + R.string.about_text2;*/
        setContentView(R.layout.aboutus);

        View projectdocumentButton = this.findViewById(R.id.project_doc_button);
        projectdocumentButton.setOnClickListener(this);
        View teamdetailsButton = this.findViewById(R.id.team_details_button);
        teamdetailsButton.setOnClickListener(this);
        
    }
    
    public void onClick(View v)
    {
    	switch(v.getId()) {
    	case R.id.project_doc_button:
    		/*Intent i1 = new Intent(this, GeoGallery.class);
    		startActivity(i1);*/
    		File file = new File("/sdcard/TeamMaverickFinalDocument.pdf");

            if (file.exists()) {
                Uri path = Uri.fromFile(file);
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setDataAndType(path, "application/pdf");
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

                try {
                    startActivity(intent);
                } 
                catch (ActivityNotFoundException e) {
                    Toast.makeText(AboutUs.this, 
                        "No Application Available to View PDF", 
                            Toast.LENGTH_SHORT).show();
                }
            }
    		break;
    	case R.id.team_details_button:
    		Intent i2 = new Intent(this, About.class);
    		startActivity(i2);
    		break;
    	
    	}
    }
}

